﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ASPMVC
{
    class Program
    {
        static void Main(string[] args)
        {
            /*ParseProcess parse = new ParseProcess();
            parse.validateNameFile(@"D:\agile4gl\1.0v\src\al-plugin-asp.net-mvc\test.agile");
            parse.processFile();*/

            /*Generate generate = new Generate();
            generate.outputDir = @"D:\agile4gl\1.0v\src\al-plugin-asp.net-mvc\test";
            generate.readXML(@"D:\agile4gl\1.0v\src\al-plugin-asp.net-mvc\meta.xml");
            generate.process();*/

            Console.WriteLine("Welcome AgileLang Generate::ASP.Net MVC");
            Console.WriteLine("-----------------------------------");
            String path = "";
            String files = "";
            String files_x = "";
            String cmd = "";
            for (int i = 0; i < args.Length; i++) {
                if (args[i].Equals("-x")) {
                    cmd = "filex";
                    continue;
                }
                if (args[i].Equals("-f")) {
                    cmd = "files";
                    continue;
                }
                if (args[i].Equals("-o")) {
                    cmd = "out";
                    continue;
                }
                if (cmd.Equals("out")) {
                    path = path + args[i];
                    continue;
                }
                if (cmd.Equals("filex")) {
                    files_x = files_x + args[i] + " ";
                    continue;
                }
                if (cmd.Equals("files")) {
                    files = files + args[i] + " ";
                    continue;
                }
            }
        //----------------------------------------------------------------------
            ParseProcess parse = new ParseProcess();
            parse.validateNameFile(files);
            parse.processFile();

            System.IO.DirectoryInfo directoryInfo =
                    System.IO.Directory.GetParent(files);
          

            Generate generate = new Generate();
            generate.outputDir = path;
            generate.readXML(directoryInfo.FullName + "/meta.xml");
            generate.process();
        //----------------------------------------------------------------------
        
        }
    }
}
